/**
 * @author [siwi]
 * @email [siwi@siwi.me]
 * @create date 2017-09-02 02:32:23
 * @modify date 2017-09-02 02:32:23
 * @desc [oauth code]
*/

const { mongoose, Schame } = require('../Mongoose')

const Table = new Schame({
    // 用户id
    user_id: {
        type: String,
        required: true,
    },
    // 客户端id
    client_id: {
        type: String,
        required: true,
    },
    //作用域
    scopes: {
        type: Array,
        default:[]
    },
    // 是否有效
    revoked: {
        type: Boolean,
        default: false
    },
    // 过期时间
    expires_at: {
        type: Date
    }
})

const OauthCode = mongoose.model('OauthCode', Table, 'oauth_auth_codes')
module.exports = OauthCode
